Skip to main content

Pie Chart

Illustrates the proportion of each category within a whole. Each slice of the pie represents a category, and the size of the slice corresponds to the proportion of that category within the whole. Pie charts are often used for simple comparisons of relative sizes, such as market share, budget allocation, or demographic composition.

Chart:


Code:

  muze
.canvas()
.rows([{ field: "Year", as: "discrete" }, "dummy"])
.layers([
{
mark: "arc",
encoding: {
color: "Cylinders",
radius: "Miles_per_Gallon",
size: {
value: () => 0.7,
},
text: "Cylinders",
},
},
])
.config({
axes: {
y: {
fields: {
dummy: {
show: false,
},
},
compact: true,
labels: {
rotation: 0,
},
},
},
})